import 'package:flutter/material.dart';
import 'package:znmm/UI/A_Common/PTDropDownMenu.dart';
import 'package:znmm/UI/A_Common/universal_dialog.dart';
import 'package:znmm/UI/utils/my_global.dart';
import 'package:znmm/config/app_color.dart';

import 'calendar_view.dart/date_picker.dart';

class Test1Page extends StatefulWidget {
  const Test1Page({super.key});

  @override
  State<Test1Page> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<Test1Page> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: AppColor.backgroundColor,
        appBar: MyGlobal.getNavigationBar(context, "Test1Page", actions: [
          IconButton(
            onPressed: () {},
            icon: const Icon(Icons.list),
            iconSize: 25,
            color: Colors.black,
          )
        ]),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Container(
              margin: const EdgeInsets.fromLTRB(16, 5, 10, 5),
              child: PTDropDownMenu(
                bIsReSet: true,
                clickBack: (data) {
                  print('逆序/正序:$data');
                },
                fItemHeight: 40,
                fHeight: 220,
                fWidth: 160,
                iSelTag: 0,
                hintText: "请选择", ////请选择
                mlist: const [
                  "1111111111",
                  "2222222222222",
                  "333",
                  "666",
                  "88888",
                  "9999",
                  "666"
                ], //"逆序", "正序"
              ),
            ),
            const SizedBox(
              height: 20,
            ),
            Container(
              decoration: BoxDecoration(
                color: Colors.white, // 背景色
                borderRadius: BorderRadius.circular(12), // 圆角
                boxShadow: [
                  BoxShadow(
                    color: Colors.black.withOpacity(0.2), // 阴影颜色
                    blurRadius: 6, // 模糊半径
                    spreadRadius: 2, // 扩散半径
                    offset: const Offset(2, 4), // 偏移量 (x, y)
                  ),
                ],
              ),
              child: const Padding(
                padding: EdgeInsets.all(16),
                child: Text("带阴影的圆角Container"),
              ),
            ),
            const SizedBox(
              height: 20,
            ),
            ElevatedButton(
              onPressed: () {
                UniversalDialog.show(
                  context: context,
                  title: "系统提示",
                  content: "确定要执行此操作吗？",
                  onConfirm: () => print("已确认"),
                  onCancel: () => print("已取消"),
                );
              },
              child: const Text("打开弹框"),
            ),
            const SizedBox(
              height: 20,
            ),
            Container(
                color: Colors.amber,
                height: 150, // 这里给定一个具体的高度
                width: double.infinity,
                child: DatePicker(
                  upperLimit: DateTime(2025, 12, 31),
                  lowerLimit: DateTime(2020, 1, 1),
                  dateChangedCallback: (DateTime selectedDate) {
                    print("选中的日期: ${selectedDate.toLocal()}");
                  },
                ))
          ],
        ));
  }
}
